#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;

#define N 10000

int main()
{
	char *strSrc = new char[N];
	char *result = new char[N];
	int length,resultIndex;
	while( cin.getline(strSrc,N) )
	{
		length = strlen(strSrc);
		resultIndex = 0;

		int end = -1;
		for(int i=length-1; i>-1; i--)
		{
			if( (strSrc[i]>='a'&&strSrc[i]<='z') || (strSrc[i]>='A'&&strSrc[i]<='Z') )
			{
				if( -1 == end )
				{
					end = i;	
				}
				
				if(i==0)
				{
					if(resultIndex != 0)
						result[resultIndex++] = ' ';
					
					for(int k=i; k<=end; k++)
					{
						result[resultIndex++] = strSrc[k];
					}
				}
			}// end of if
			else
			{
				if( -1!= end )
				{
					if(resultIndex != 0)
						result[resultIndex++] = ' ';
					
					for(int k=i+1; k<=end; k++)
					{
						result[resultIndex++] = strSrc[k];
					}
					
					end = -1;
				}
			} // end of else
		} // end of for 
		result[resultIndex] = '\0';
		printf("%s\n", result);
	}// end of while
	return 0;
}
